xen.git
16 years agoxend: VBD QoS policy bits
Keir Fraser [Fri, 14 Aug 2009 16:10:11 +0000 (17:10 +0100)]
xend: VBD QoS policy bits

Add the ability to define VBD QoS policy in the xend layer.

Consider the following vbd entry:

vbd = [
   'phy:/dev/server/virtualmachine1-disk,xvda1,w,credit=3D5000/s@50ms',
]

This means that a VM may perform 5000 I/O operations per second, with
credit being replenished every 50 milliseconds.

The 'credit' xenstore value is by the blkback driver to ratelimit I/O
operations for the specific device.

Signed-off-by: William Pitcock <nenolod@dereferenced.org>
16 years agox86 mce: move mce quirks into separate files
Keir Fraser [Fri, 14 Aug 2009 16:09:39 +0000 (17:09 +0100)]
x86 mce: move mce quirks into separate files
Quirk handling is designed to easily add more quirks when needed
w/o messing around in the normal mce code.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxsm/flask: Fix AVC audit message format
Keir Fraser [Fri, 14 Aug 2009 16:08:38 +0000 (17:08 +0100)]
xsm/flask:  Fix AVC audit message format

Fix formatting of Flask AVC audit messages so that existing
policy tools can parse them.  After applying,
'xm dmesg | audit2allow' yields the expected result.

Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
16 years agoxsm/flask: Fix sidtab locking bug
Keir Fraser [Fri, 14 Aug 2009 16:08:12 +0000 (17:08 +0100)]
xsm/flask:  Fix sidtab locking bug

We do not need to use the _irqsave/irqrestore forms of spin locking
within the sidtab in Xen's XSM Flask module, and doing so triggers a
BUG_ON() within check_lock() when we subsequently call xmalloc().
This was preventing Xen from booting with XSM/Flask enabled if built
with debug=y. It appears that this broke upon the changes to xmalloc
in changeset 18379:14a9a1629590.

Signed-off-by: Stephen D. Smalley <sds@tycho.nsa.gov>
Signed-off-by: George S. Coker, II <gscoker@alpha.ncsc.mil>
16 years agoAMD IOMMU: Destroy passthru guests when IO pagetable allocation fails
Keir Fraser [Fri, 14 Aug 2009 16:07:23 +0000 (17:07 +0100)]
AMD IOMMU: Destroy passthru guests when IO pagetable allocation fails

Signed-off-by: Wei Wang <wei.wang2@amd.com>
Acked-by: Wei Huang <wei.huang2@amd.com>
16 years agox86: cleanup rdmsr/wrmsr
Keir Fraser [Fri, 14 Aug 2009 11:26:35 +0000 (12:26 +0100)]
x86: cleanup rdmsr/wrmsr

Use a 64bit value instead of extracting/merging two 32bit values.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 mce: make debug messages less noisy
Keir Fraser [Fri, 14 Aug 2009 09:59:13 +0000 (10:59 +0100)]
x86 mce: make debug messages less noisy

On guest MCE read only print debug code when
a non-zero value has been read. Xen is too
noisy, otherwise.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoVMX: issue an NMI rather than just calling the NMI handler
Keir Fraser [Fri, 14 Aug 2009 09:58:32 +0000 (10:58 +0100)]
VMX: issue an NMI rather than just calling the NMI handler
when the VMEXIT code indicates that an NMI has been raised.
Otherwise we might hit a real NMI while in the handler.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
16 years agohvm: handle access to MSR_AMD64_NB_CFG
Keir Fraser [Fri, 14 Aug 2009 09:57:24 +0000 (10:57 +0100)]
hvm: handle access to MSR_AMD64_NB_CFG

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Remove EF_* duplicate defs for X86_EFLAGS_*.
Keir Fraser [Fri, 14 Aug 2009 07:36:12 +0000 (08:36 +0100)]
x86: Remove EF_* duplicate defs for X86_EFLAGS_*.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Do not clear EF.TF in crash-debug mode.
Keir Fraser [Fri, 14 Aug 2009 07:22:34 +0000 (08:22 +0100)]
x86: Do not clear EF.TF in crash-debug mode.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agogdbstub: Fix the build and make a few cleanups.
Keir Fraser [Thu, 13 Aug 2009 07:40:39 +0000 (08:40 +0100)]
gdbstub: Fix the build and make a few cleanups.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agogdbstub: Small fixes.
Keir Fraser [Wed, 12 Aug 2009 13:27:52 +0000 (14:27 +0100)]
gdbstub: Small fixes.

 * Correctly handly EFLAGS.TF in the hypervisor
 * Register value sent with 'P' command is in native byte order.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 numa: fix nodes' memory parsing when SRAT table includes future-hotplug memory...
Keir Fraser [Wed, 12 Aug 2009 13:16:09 +0000 (14:16 +0100)]
x86 numa: fix nodes' memory parsing when SRAT table includes future-hotplug memory range

A node's future-hotplug memory range starts from very high end
normally, e.g. 1TB, and is not continuous with its current existing
memory range. It should not be covered by the global variable 'nodes'
as it assumes the node's memory is continuous. Otherwise it can make
nodes' memory ranges become very big and overlapped, and
populate_memnodemap() fails.

We can ignore future-hotplug memory range for now. Physical memory
hotplug support in future will handle it.

Signed-off-by: Yang Xiaowei <xiaowei.yang@intel.com>
16 years agox86 svm: Fix PAT MSR handling when using Nested Paging.
Keir Fraser [Wed, 12 Aug 2009 13:13:54 +0000 (14:13 +0100)]
x86 svm: Fix PAT MSR handling when using Nested Paging.

Accesses to the MSR should not be intercepted.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 svm: Fix the build: vlapic_get_reg() takes two arguments.
Keir Fraser [Wed, 12 Aug 2009 13:13:00 +0000 (14:13 +0100)]
x86 svm: Fix the build: vlapic_get_reg() takes two arguments.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: one-liner correcting stat parsing ordering
Keir Fraser [Wed, 12 Aug 2009 13:06:30 +0000 (14:06 +0100)]
tmem: one-liner correcting stat parsing ordering

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
16 years agox86 svm: Fix checked builds of Windows running on AMD SVM
Keir Fraser [Wed, 12 Aug 2009 13:06:01 +0000 (14:06 +0100)]
x86 svm: Fix checked builds of Windows running on AMD SVM

Checked builds of Windows will, after every modification of the TPR,
read it back again and assert that the value read back matches with
the value written, including the priority sub-class.  Make sure that
we correctly preserve it on vmexit.

As far as I can tell from reading the documentation, the sub-class
doesn't actually do anything, so this should be pretty harmless.

Signed-off-by: Steven Smith <steven.smith@eu.citrix.com>
16 years agoxentrace: fix "%016x" format
Keir Fraser [Tue, 11 Aug 2009 06:36:26 +0000 (07:36 +0100)]
xentrace: fix "%016x" format

xentrace_format cannot use "0x016x" format as we expect.
It show only %(N) as "0x016x" format, not as "%(N+1)08x%(N)08x".
So I fixed tools/xentrace/formats by using "%(N+1)08x%(N)08x" format.
Also I added some TRC_PV entries.

Signed-off-by: Akio Takebe <takebe_akio@jp.fujitsu.com>
16 years agolibxc: Include private Xen headers in stubdom libxc build
Keir Fraser [Tue, 11 Aug 2009 06:34:55 +0000 (07:34 +0100)]
libxc: Include private Xen headers in stubdom libxc build

The headers libelf.h and elfstructs.h were removed from
xen/include/public in 19011:7df072566b8c.  But this broke the stubdom
build because parts of libxc depend on them.  This patch adds
$(XEN_ROOT)/xen/include/xen to the stubdom -I path.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 years agoUpdate QEMU_TAG to a83d119cfcc20bc7edb427992d6e31b3e99430be
Keir Fraser [Mon, 10 Aug 2009 17:15:19 +0000 (18:15 +0100)]
Update QEMU_TAG to a83d119cfcc20bc7edb427992d6e31b3e99430be

16 years agoRevert alloc_idle_vcpu() to support multiple idle domains where max
Keir Fraser [Mon, 10 Aug 2009 12:51:28 +0000 (13:51 +0100)]
Revert alloc_idle_vcpu() to support multiple idle domains where max
vcpus is less than max pcpus (e.g., can happen on i386).

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: make mce debug output more verbose
Keir Fraser [Mon, 10 Aug 2009 12:33:01 +0000 (13:33 +0100)]
x86: make mce debug output more verbose

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Remove cpumask.h inclusion from mm.h
Keir Fraser [Mon, 10 Aug 2009 12:32:02 +0000 (13:32 +0100)]
x86: Remove cpumask.h inclusion from mm.h

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agopygrub: Remove bogus log.debug line.
Keir Fraser [Mon, 10 Aug 2009 12:30:50 +0000 (13:30 +0100)]
pygrub: Remove bogus log.debug line.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: expose freeable memory
Keir Fraser [Mon, 10 Aug 2009 12:27:54 +0000 (13:27 +0100)]
tmem: expose freeable memory

Expose tmem "freeable" memory for use by management tools.

Management tools looking for a machine with available
memory often look at free_memory to determine if there
is enough physical memory to house a new or migrating
guest.  Since tmem absorbs much or all free memory,
and since "ephemeral" tmem memory can be synchronously
freed, management tools need more data -- not only how
much memory is "free" but also how much memory is
"freeable" by tmem if tmem is told (via an already
existing tmem hypercall) to relinquish freeable memory.
This patch provides that extra piece of data (in MB).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
16 years agotools: Fix iptables failure test in vif-common.sh
Keir Fraser [Fri, 7 Aug 2009 16:31:27 +0000 (17:31 +0100)]
tools: Fix iptables failure test in vif-common.sh

In changset 19540 a bug was introduced in the fib_iptable function in
vif-common.sh that incorrectly checks the exit status of iptables --
it always believes iptables has failed even when it hasn't.

The attached patch fixes that.  It's also bug 1490.

Signed-off-by: John Haxby <john.haxby@oracle.com>
16 years agox86: replace PAT initialisation magic value with a #define
Keir Fraser [Fri, 7 Aug 2009 16:30:33 +0000 (17:30 +0100)]
x86: replace PAT initialisation magic value with a #define

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86: Increase default max CPUs to 64.
Keir Fraser [Fri, 7 Aug 2009 16:29:50 +0000 (17:29 +0100)]
x86: Increase default max CPUs to 64.

Also remove compile-time limit of 32 for i386. It is no longer
required, since a cpumask was moved out of struct page_info.

Signed-off-by: Wei Gang <gang.wei@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86 p2m: use common p2m ops in common p2m code path
Keir Fraser [Fri, 7 Aug 2009 16:23:11 +0000 (17:23 +0100)]
x86 p2m: use common p2m ops in common p2m code path

We found recently there was an assertion failure when EPT mode is
enabled on 32PAE host when debug=y is used. The patch attached fixes
that. It uses the common p2m ops in the
common p2m code path p2m_remove_page rather than calling
p2m_gfn_to_mfn() for only shadow mode.

Signed-off-by: Xin, Xiaohui <xiaohui.xin@intel.com>
16 years agoxend: Rename device backend value when xm save/migrate
Keir Fraser [Fri, 7 Aug 2009 16:22:04 +0000 (17:22 +0100)]
xend: Rename device backend value when xm save/migrate

The Xend has a problem that it often fails to restore/migrate
a PV domain whose device backends are partly a driver domain.

Because a checkpoint of the PV domain has device backend value as
domain id, you can restore/migrate the PV domain only when a driver
domain is the same id as device backend value in the checkpoint.

I attached a patch to fix it by renaming device backend value in a
checkpoint from domain id to domain name when xm save/migrate.

This patch doesn't rename device backend value if the value is 0,
which is Domain-0, so the checkpoint format is compatible if you use
only Domain-0 as device backend.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
16 years agox86_emulate: Fixes for 'mov rm16,sreg'
Keir Fraser [Fri, 7 Aug 2009 09:53:22 +0000 (10:53 +0100)]
x86_emulate: Fixes for 'mov rm16,sreg'

1. Memory reads should be 16 bits only
2. Attempt to load %cs should result in #UD

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86_emulate: protmode_load_seg() cannot load system segments in long mode.
Keir Fraser [Fri, 7 Aug 2009 08:54:43 +0000 (09:54 +0100)]
x86_emulate: protmode_load_seg() cannot load system segments in long mode.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Regression tests need 16MB to run. Check for this.
Keir Fraser [Thu, 6 Aug 2009 10:14:48 +0000 (11:14 +0100)]
hvmloader: Regression tests need 16MB to run. Check for this.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoept: code clean up and formatting.
Keir Fraser [Thu, 6 Aug 2009 09:02:20 +0000 (10:02 +0100)]
ept: code clean up and formatting.

Fix alignment and comments and add and remove spaces and lines where
appropriate.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agox86_emulate: Remove cmpxchg retry loop from protmode_load_seg().
Keir Fraser [Thu, 6 Aug 2009 08:54:22 +0000 (09:54 +0100)]
x86_emulate: Remove cmpxchg retry loop from protmode_load_seg().

It is safer to retry in a loop via the caller.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: Remove bogus variable decl, fixing build.
Keir Fraser [Thu, 6 Aug 2009 08:53:37 +0000 (09:53 +0100)]
tmem: Remove bogus variable decl, fixing build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotmem: save/restore/migrate/livemigrate and shared pool authentication
Keir Fraser [Thu, 6 Aug 2009 08:19:55 +0000 (09:19 +0100)]
tmem: save/restore/migrate/livemigrate and shared pool authentication

Attached patch implements save/restore/migration/livemigration
for transcendent memory ("tmem").  Without this patch, domains
using tmem may in some cases lose data when doing save/restore
or migrate/livemigrate.  Also included in this patch is
support for a new (privileged) hypercall for authorizing
domains to share pools; this provides the foundation to
accomodate upstream linux requests for security for shared
pools.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
16 years agoept mtrr: replace unsigned long with mfn_t for mfns.
Keir Fraser [Thu, 6 Aug 2009 08:15:42 +0000 (09:15 +0100)]
ept mtrr: replace unsigned long with mfn_t for mfns.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoept p2m: replace unsigned long with mfn_t for mfns.
Keir Fraser [Thu, 6 Aug 2009 08:15:24 +0000 (09:15 +0100)]
ept p2m: replace unsigned long with mfn_t for mfns.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoept p2m: set rwx flags to 0 for invalid and mmio_dm types.
Keir Fraser [Thu, 6 Aug 2009 08:14:52 +0000 (09:14 +0100)]
ept p2m: set rwx flags to 0 for invalid and mmio_dm types.

Read/write/execute flags are set to 1 before calling the type_to_flags
function which sets them to their appropriate values depending on the
p2m type. However, in invalid, mmio_dm, and default/unknown cases in
type_to_flags just falls through, unsafely leaving full access to
these pages.

Signed-off-by: Patrick Colp <Patrick.Colp@citrix.com>
16 years agoRevert 20006:edf21ab7d7a4 and 20023:2b28320c6f8c.
Keir Fraser [Wed, 5 Aug 2009 13:56:29 +0000 (14:56 +0100)]
Revert 20006:edf21ab7d7a4 and 20023:2b28320c6f8c.

16 years agoRevert to pulling QEMU GIT repo via HTTP.
Keir Fraser [Wed, 5 Aug 2009 13:39:46 +0000 (14:39 +0100)]
Revert to pulling QEMU GIT repo via HTTP.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Remove _setSchedParams
Keir Fraser [Wed, 5 Aug 2009 13:03:38 +0000 (14:03 +0100)]
xend: Remove _setSchedParams

Currently, xc.sched_credit_domain_set is called twice when domains
are created.

start@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _initDomain
    _setSchedParams
      domain_sched_credit_set
        xc.sched_credit_domain_set  --- 2nd

resume@XendDomainInfo
  _constructDomain
    xc.sched_credit_domain_set  --- 1st
  _setSchedParams
    domain_sched_credit_set
      xc.sched_credit_domain_set  --- 2nd

This patch removes _setSchedParams method added by changeset 19955,
because xc.sched_credit_domain_set was added into _constructDomain
method by changeset 20006.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agox86 vmx: Accelerate VLAPIC EOI writes
Keir Fraser [Wed, 5 Aug 2009 13:02:46 +0000 (14:02 +0100)]
x86 vmx: Accelerate VLAPIC EOI writes

Our testing indicates that most apic accesses are eoi writes. This
patch accelerate guest EOI emulation utilizing HW VM Exit
information.

Without this patch, xentrace shows the apci access average tsc costs
is ~7.8k in our case and it down to ~3k with it. We also save 3% cpu
in our case.

From: Yang Zhang <yang.zhang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: CPU synchronization while doing MTRR register update
Keir Fraser [Wed, 5 Aug 2009 12:50:36 +0000 (13:50 +0100)]
x86: CPU synchronization while doing MTRR register update

The current Xen code does not synchronize all the cpus while
initializing MTRR registers when a cpu comes up.=20

As per IA32 SDM vol 3: Section: 10.11.8 MTRR Considerations in MP
Systems, all the processors should be synchronized while updating
MTRRs.

Processors starting with westmere are caching VMCS data for better VMX
performance. These processors also has Hyper-threading support. With
hyper-threading, when one thread's cache is disabled, it also disables
cache for the sibling threads. And MTRR register updating procedure
involves cache disabling. So if cpus are not synchronized, updating
MTRR registers on a thread, results in the VMCS data from sibling
threads becoming inaccessible, and it causes system failure.

With this patch while updating the MTRR registers, all the cpus are
synchronized as per the IA32 SDM. Also at the boot time and resume
time when multiple cpus are brought up, an optimization is added to
delay the MTRR initialization until all the cpus are up, to avoid
multiple times cpu synchronization.

Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Suresh B Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Asit K Mallick <asit.k.mallick@intel.com>
16 years agox86: Enable GNTTABOP_copy hypercall for HVMs
Keir Fraser [Wed, 5 Aug 2009 12:49:35 +0000 (13:49 +0100)]
x86: Enable GNTTABOP_copy hypercall for HVMs

This requires plumbing 32-bit compat guests through the compat version
of teh grant-table hypercall.

Signed-off-by: Jayaraman, Bhaskar <Bhaskar.Jayaraman@lsi.com>
16 years agoxm-test restore: use ext3 (instead of ext2) and xvda (instead of hda)
Keir Fraser [Wed, 5 Aug 2009 12:40:21 +0000 (13:40 +0100)]
xm-test restore: use ext3 (instead of ext2) and xvda (instead of hda)

This patch fixes the xm-test restore 04 testcase:
o uses ext3 instead of ext2 - which is not supported by the standard
kernel config
o uses xvdX instead of hdX for disks

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: Disable DEBUG_STACK_USAGE which breaks test cases
Keir Fraser [Wed, 5 Aug 2009 12:39:37 +0000 (13:39 +0100)]
xm-test: Disable DEBUG_STACK_USAGE which breaks test cases

The unnecessary 'used greatest stack depth' messages on the console
breaks xm-test cases by random.  Typically a testcase reads input from
the console and parses it.  When DEBUG_STACK_USAGE is enabled, these
stack usage messages are printed by random - the test case reads this
message, cannot handle it and fails.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: fix network13 test (protocol and extensions)
Keir Fraser [Wed, 5 Aug 2009 12:38:38 +0000 (13:38 +0100)]
xm-test: fix network13 test (protocol and extensions)

Attached there is a patch that fixes the used protocol (was udp - but
nobody was listening...) to icmp echo and added the extension, that
the dom0 and the other guest ips are also pinged.
Because of the many different scenarios (three nested loops) over
packet sizes, two guests and different ip addresses, one run of this
test case takes now about 4.5 minutes.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: Adapt memory setting to up-to-date kernel memory consumption
Keir Fraser [Wed, 5 Aug 2009 12:37:26 +0000 (13:37 +0100)]
xm-test: Adapt memory setting to up-to-date kernel memory consumption

The attached patch fixes xm-test memset 04 that it can be used with up
to date kernels.  The old version sets the memory to 15MByte which is
too low for modern kernels: the oom-killer in this case kills the
login shell of the test-case and init.  Increased the size to 18M
which gives the userspace about 2.5 MByte memory.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: 10_block_attach_detach_multiple_devices fixed
Keir Fraser [Wed, 5 Aug 2009 12:36:24 +0000 (13:36 +0100)]
xm-test: 10_block_attach_detach_multiple_devices fixed

This patch fixes and (re-)enables test 10 of the block-create suite.
The tests by random attach and detach devices to / from a domU and
checks if everything is ok.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test block-create: use ext3 as filesystem
Keir Fraser [Wed, 5 Aug 2009 11:06:24 +0000 (12:06 +0100)]
xm-test block-create: use ext3 as filesystem

The current implementation uses ext2 for tests.  The tests currently
fail, because the current kernel does not support ext2 by default.
This patch creates an ext3 filesystem for the tests.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxend: fix memory leak resulting in long garbage collector runs
Keir Fraser [Wed, 5 Aug 2009 11:04:39 +0000 (12:04 +0100)]
xend: fix memory leak  resulting in long garbage collector runs

In the method xen.xend.XendStateStore.XendStateStore.load_state and
xen.xend.XendStateStore.XendStateStore.save_state the minidom objects
used to load/save the current state of a device type, can't be freed
by the python garbage collector after all references to the top node
are cleared, because of cyclic references between the DOM nodes. So
memory usage of xend increases after calling these methods.  To solve
this problem, the unlink() method must be called for a minidom object
before the last reference to the top node is cleared (see python
docs). This breaks the cyclic references, so the garbage collector can
free these objects.

Signed-off-by: juergen.gross@ts.fujitsu.com
16 years agoxend: pass-through: Extend multi-function mapping
Keir Fraser [Wed, 5 Aug 2009 11:03:53 +0000 (12:03 +0100)]
xend: pass-through: Extend multi-function mapping

This extends the mapping between physical and virtual PCI functions
for multi-function pass-through in two ways. If neither of these
rules apply the existing identity-mapping of physical to virtual
functions is used.

1) If physical function zero is not present in a multi-function
   pass-through device then the numerically lowest physical function
   whose virtual function hasn't explicitly been set will be mapped
   to virtual function 0.

   This is to satisfy the requirement that a (virtual) device
   must always have function 0 present.

2) The virtual function to be used for a physical function may
   be explicitly set.

   e.g. 00:1d.2=3D0,1=3D1,0=3D2@7 will result in the following
   mapping:

        physical | virtual
        ---------+--------
        00:1d.2  | 00:07.0
        00:1d.1  | 00:07.1
        00:1d.0  | 00:07.2

   Ranges may also be used with explicit assignment.
   The following would result in the same mapping as above:

       00:1d.2=3D0-0=3D2@7

Please be aware that it is very likely that using these extensions
it is possible to create mappings that do not work. If in doubt
please use identity-mapping.

Cc: Dexuan Cui <dexuan.cui@intel.com>
Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agoxend: passthrough: add checking when a device is hotplugged into pv guest.
Keir Fraser [Wed, 5 Aug 2009 11:03:08 +0000 (12:03 +0100)]
xend: passthrough: add checking when a device is hotplugged into pv guest.

When we 'xm pci-attach' device into pv guest, we also need to check if
the device is owned by pciback or pci-stub, if the device has been
assigned, etc.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoAdd a single trigger for all diagnostic keyhandlers
Keir Fraser [Sun, 2 Aug 2009 12:43:15 +0000 (13:43 +0100)]
Add a single trigger for all diagnostic keyhandlers

Add a new keyhandler that triggers all the side-effect-free
keyhandlers.  This lets automated tests (and users) log the full set
of keyhandlers without having to be aware of which ones might reboot
the host.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoMake ACPI Cx keyhandler always print something
Keir Fraser [Sun, 2 Aug 2009 11:29:25 +0000 (12:29 +0100)]
Make ACPI Cx keyhandler always print something

...so that from a serial log you can tell the difference between not
pressing the key and not having anything interestying to print.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
16 years agoxend: pci: Use PCIe FLR for VF of Intel 82599 10GbE Controller
Keir Fraser [Sun, 2 Aug 2009 11:28:22 +0000 (12:28 +0100)]
xend: pci: Use PCIe FLR for VF of Intel 82599 10GbE Controller

We know it does have PCIe FLR capability even if it doesn't report
that.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: passthrough: loosen the pci co-assignment for pv guest
Keir Fraser [Sun, 2 Aug 2009 11:27:51 +0000 (12:27 +0100)]
xend: passthrough: loosen the pci co-assignment for pv guest

In current xend, we can not assign co-assignment devices to different
guests, even for pv guests. This patch loosens the policy for pv
guest: if none of the co-assignment devices have been assigned to hvm
guest, we can assign the devices to different pv guests.

The patch also adds a detection: if a device has been assigned to
guest, we can't try to "xm pci-attach" it to the same guest again.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: save/restore cpu_weight and cpu_cap
Keir Fraser [Sun, 2 Aug 2009 11:26:23 +0000 (12:26 +0100)]
xend: save/restore cpu_weight and cpu_cap

This patch allows vcpus_params cpu_weight and cpu_cap to be saved and
restored.  Most the code to support this already existed, but the save
path needed to be updated to explicitly save these params, and the
restore path needed to be updated to resend the params down to the
kernel.

From: Andrew Jones <drjones@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoCompile the kernel by default with bridge support
Keir Fraser [Sun, 2 Aug 2009 11:25:01 +0000 (12:25 +0100)]
Compile the kernel by default with bridge support

This one-liner adds bridge support to the Linux kernel
(CONFIG_BRIDGE=y).  It is a precondition for some xm-tests that
bridge is enabled.  Also IMHO it makes sense to configure a dom0 with
bridge capabilities.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agoxm-test: ramdisk fs type is changed to ext3 if needed
Keir Fraser [Sun, 2 Aug 2009 11:23:46 +0000 (12:23 +0100)]
xm-test: ramdisk fs type is changed to ext3 if needed

This (one line) patch changes the type of the xm-test initrd from ext2
to ext3 when needed.  It first checks, if ext2 support is missing and
ext3 support is available.  If so the fs type is changed to ext3.

Signed-off-by: Andreas Florath <xen@flonatel.org>
16 years agotools/tests/regression/: Fix some paths and scripts.
Keir Fraser [Sun, 2 Aug 2009 11:22:03 +0000 (12:22 +0100)]
tools/tests/regression/: Fix some paths and scripts.

o scripts and Makefile are mostly location independent now
  (exception XEN_ROOT in Makefile)
o use of $() instead of ${} in Makefile

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <Keir.Fraser@eu.citrix.com>
16 years agoi386: fix full-value calculation of wrmsr handling for pv guests
Keir Fraser [Thu, 30 Jul 2009 16:56:23 +0000 (17:56 +0100)]
i386: fix full-value calculation of wrmsr handling for pv guests

The MSR value must be held in a 64-bit variable, not an unsigned long.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxm-test: Fix memset 01 and 02 tests: add support for sysfs memory interface
Keir Fraser [Wed, 29 Jul 2009 08:20:46 +0000 (09:20 +0100)]
xm-test: Fix memset 01 and 02 tests: add support for sysfs memory interface

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: pci: fix a typo in do_Dstate_transition
Keir Fraser [Wed, 29 Jul 2009 08:19:30 +0000 (09:19 +0100)]
xend: pci: fix a typo in do_Dstate_transition

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: pass-through Use pci_dict_to_bdf_str() in hvm_pci_device_create()
Keir Fraser [Wed, 29 Jul 2009 08:19:13 +0000 (09:19 +0100)]
xend: pass-through Use pci_dict_to_bdf_str() in hvm_pci_device_create()

* Use pci_dict_to_bdf_str() in hvm_pci_device_create()
* Use pci_name instead of pci_str in error message, pci_str does not
* exist

Signed-off-by: Simon Horman <horms@verge.net.au>
Acked-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agons16550: check_existence() can be marked __init
Keir Fraser [Tue, 28 Jul 2009 15:48:06 +0000 (16:48 +0100)]
ns16550: check_existence() can be marked __init

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agons16550: More robust check for presence of FIFO
Keir Fraser [Tue, 28 Jul 2009 15:47:37 +0000 (16:47 +0100)]
ns16550: More robust check for presence of FIFO

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoxend: make a crash dump directory per DomU
Keir Fraser [Tue, 28 Jul 2009 15:43:50 +0000 (16:43 +0100)]
xend: make a crash dump directory per DomU

Currently, xend dumps a core file of a DomU
in the directory "/var/xen/dump/", when the DomU has crashed.

The patch modifies this directory to "/var/xen/dump/<domain name>/".

It enables you to select HDD partition per DomU to dump core by using
mount command.

Signed-off-by: Rikiya Ayukawa <ayukawa.rikiya@jp.fujitsu.com>
16 years agoxend: pass-through: fix "xm pci-list-assignable-devices' for pv_guest
Keir Fraser [Tue, 28 Jul 2009 15:42:12 +0000 (16:42 +0100)]
xend: pass-through: fix "xm pci-list-assignable-devices' for pv_guest

xc.test_assign_device(dev) can only tell us if dev is assigned to hvm
guest; if a device is assigned to pv guest, xc.test_assign_device()
still tells us the device is not assigned yet, as a result, the device
still appears in the output of "xm pci-list-assignable-devices", and
xend would not prevent us from assigning the device to a new pv or hvm
guest.

To judge if a device has been assigned to guest, we have to scan
xenstore.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agoxend: pass-through: fix pci passthrough for pv guest
Keir Fraser [Tue, 28 Jul 2009 15:41:13 +0000 (16:41 +0100)]
xend: pass-through: fix pci passthrough for pv guest

C/S 19754: a5f584c1e2f6 breaks pci passthrough for pv guest.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
16 years agox86,hvm: clean up vpt's period_cycles field
Keir Fraser [Tue, 28 Jul 2009 15:40:34 +0000 (16:40 +0100)]
x86,hvm: clean up vpt's period_cycles field

In struct periodic_time, pt->period_cycles is not cpu cycles since c/s
17716 and its value is always the same as pt->period.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agotools/tests: Add syntax check for different versions of python
Keir Fraser [Tue, 28 Jul 2009 15:38:08 +0000 (16:38 +0100)]
tools/tests: Add syntax check for different versions of python

From: Andreas Florath <xen@flonatel.org>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agox86: Initialize the ACPI "safe" power state to C1.
Keir Fraser [Tue, 28 Jul 2009 15:34:16 +0000 (16:34 +0100)]
x86: Initialize the ACPI "safe" power state to C1.

Initialize the ACPI "safe" power state to C1.  This avoids a null
dereference on BIOS tables which define C3 but not C2 or C1.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
16 years agoxend: fix migration hangs by closing fds on exec
Keir Fraser [Tue, 28 Jul 2009 15:33:46 +0000 (16:33 +0100)]
xend: fix migration hangs by closing fds on exec

Signed-off-by: Zhigang Wang <zhigang.x.wang@oracle.com>
Reviewed-by: Xiaowei Hu <xiaowei.hu@oracle.com>
16 years agoxend: pass-through: device state in xenstore may be null
Keir Fraser [Tue, 28 Jul 2009 15:32:26 +0000 (16:32 +0100)]
xend: pass-through: device state in xenstore may be null

Signed-off-by: Tom Rotenberg <tom.rotenberg@gmail.com>
16 years agopassthrough: use tasklet to deliver interrupts
Keir Fraser [Tue, 28 Jul 2009 15:28:21 +0000 (16:28 +0100)]
passthrough: use tasklet to deliver interrupts

This patch enables delivery of interrupts even if the VCPU#0 is
halted.

Note: the changes to softirq.{ch} are needed for ia64 build.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
16 years agohvm vlapic: Fix vlapic_write() for partial register writes.
Keir Fraser [Tue, 28 Jul 2009 15:24:47 +0000 (16:24 +0100)]
hvm vlapic: Fix vlapic_write() for partial register writes.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: pass-through: Use parse_pci_name() in find_parent()
Keir Fraser [Tue, 28 Jul 2009 15:16:32 +0000 (16:16 +0100)]
xend: pass-through: Use parse_pci_name() in find_parent()

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agox86_32: handle x87 opcodes in TLS segment fixups
Keir Fraser [Tue, 28 Jul 2009 15:15:18 +0000 (16:15 +0100)]
x86_32: handle x87 opcodes in TLS segment fixups

This patch adds support to the TLS fixup code for x87 opcodes.  These
can be treated like 2-byte opcodes with a weird encoding.

The patch includes some extra changes because, now that we have >2
opcode tables and 9 different lead bytes in a two-byte opcode, a
simple boolean code will not be enough to differentiate one- and
two-byte opcodes.  Besides this, the patch is trivial since the
segment fixup code cares about the operands of the instruction, not
about its semantics.

From: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoRevert 19961: breaks xend start on some systems.
Keir Fraser [Fri, 24 Jul 2009 11:08:54 +0000 (12:08 +0100)]
Revert 19961: breaks xend start on some systems.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxend: Fix use of set() for Python 2.3.
Keir Fraser [Fri, 24 Jul 2009 09:39:43 +0000 (10:39 +0100)]
xend: Fix use of set() for Python 2.3.

From: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agohvmloader: Fix get_memsize() to cast high_mem_pgend to 64 bits.
Keir Fraser [Fri, 24 Jul 2009 09:37:52 +0000 (10:37 +0100)]
hvmloader: Fix get_memsize() to cast high_mem_pgend to 64 bits.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
16 years agopython: make tools/python/xen/util/fileuri.py work on python 2.3
Keir Fraser [Thu, 23 Jul 2009 08:01:30 +0000 (09:01 +0100)]
python: make tools/python/xen/util/fileuri.py work on python 2.3

@staticmethod syntax sugar was introduced at python2.4.
expand the syntax sugar for python 2.3

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agohoplugpath.sh: fix Makefile dependency.
Keir Fraser [Thu, 23 Jul 2009 08:00:55 +0000 (09:00 +0100)]
hoplugpath.sh: fix Makefile dependency.

In tools/hotplug/common/Makefile, install-scripts depends on genpath.
So add its dependency. Otherwise parallel build sometimes fails as
follows.

genpath and install-scripts command are being run simultaneously.
So When install-scripts tries to install it, it can be under creation.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoxend: Don't call decode() if PV_{kernel,ramdisk} are ''
Keir Fraser [Thu, 23 Jul 2009 08:00:21 +0000 (09:00 +0100)]
xend: Don't call decode() if PV_{kernel,ramdisk} are ''

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
16 years agoxend: Set up CPUID leaves on restore for both PV and HVM guests.
Keir Fraser [Thu, 23 Jul 2009 07:59:03 +0000 (08:59 +0100)]
xend: Set up CPUID leaves on restore for both PV and HVM guests.

From: Andrew Thomas <andrew.thomas@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agofs-front: cope with a missing fs-backend
Keir Fraser [Thu, 23 Jul 2009 07:57:02 +0000 (08:57 +0100)]
fs-front: cope with a missing fs-backend

Obviously save\restore is not going to work if fs-backend is missing,
but at least the stubdom will be able to work correctly in all the
other cases.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
16 years agostubdom: update README as no reason to specify absolute paths
Keir Fraser [Thu, 23 Jul 2009 07:56:15 +0000 (08:56 +0100)]
stubdom: update README as no reason to specify absolute paths

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoRevert QEMU_TAG to 5cc34ea27f1cbd1a0560cfca91fb89ccd6d5726f
Keir Fraser [Thu, 23 Jul 2009 07:53:00 +0000 (08:53 +0100)]
Revert QEMU_TAG to 5cc34ea27f1cbd1a0560cfca91fb89ccd6d5726f

xenstore lowlevel function changes breaks stubdom build.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agotools: xenbackendd for NetBSD
Keir Fraser [Wed, 22 Jul 2009 13:37:30 +0000 (14:37 +0100)]
tools: xenbackendd for NetBSD

Attached patch introduces xenbackendd. It is used on NetBSD
to launch the hotplug scripts. Later xenbackendd can be improved to
also launch qemu-dm as child process and will notice when qemu-dm
crashes.

The changes the patch makes:
- rename hotplug scripts as xenbackendd expects them
  (current names were taken from pkgsrc)
- install hotplug scripts as executable scripts
- introduce xenbackendd
- build/install/launch on NetBSD only

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agopage allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()
Keir Fraser [Wed, 22 Jul 2009 13:06:21 +0000 (14:06 +0100)]
page allocator: add mfn_valid() check to free_heap_pages() and scrub_pages()

The changesets, 19913:ef38784f9f85 and 19914:d6c1d7992f43 eliminates
boot allocator bitmap which is also used for buddy allocator bitmap.
With those patches, xen/ia64 doesn't boot because page allocator
touches struct page_info which doesn't exist.
That happends because memory is populated sparsely on ia64
and struct page_info is so.

This patches fixes ia64 boot failure.
In fact, this is also a potential bug on x86. max_page seems
to be well aligned so that MAX_ORDER loop check prevented
to be bug appear.

- fix free_heap_pages().
  When merging chunks, buddy page_info() doesn't always exists.
  So check it by mfn_valid().

- fix scrub_pages()
  On ia64 page_info() is sparsely populated, so struct page_info
  doesn't always exist. Check it by mfn_valid()

- offline_pages(), online_pages() and query_page_offline()
  Also replace "< max_page" check with mfn_valid() for consistency.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
16 years agoxend: pass-through: use identity-mapping of PCI functions
Keir Fraser [Wed, 22 Jul 2009 13:05:26 +0000 (14:05 +0100)]
xend: pass-through: use identity-mapping of PCI functions

This reverses changeset "xend: pass-through: Implement least-mapping
of virtual" (19854:22067ba1de0d) and reverts the code to identity
mapping physical PCI functions to virtual ones when multi-function
virtual devices are in use. It is my opinion that this is both safer
and simpler than least-mapping, and that in the absence of further
analysis identity-mapping the best choice for now.

Signed-off-by: Simon Horman <horms@verge.net.au>
16 years agotools: implement balloon stat and cpuinfo for NetBSD
Keir Fraser [Wed, 22 Jul 2009 13:04:14 +0000 (14:04 +0100)]
tools: implement balloon stat and cpuinfo for NetBSD

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agox86 mce: Fix formatting in a couple of printks.
Keir Fraser [Wed, 22 Jul 2009 13:03:32 +0000 (14:03 +0100)]
x86 mce: Fix formatting in a couple of printks.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
16 years agoUpdate QEMU_TAG to a42b67ed27a9744a2492c8ffe5c26935bd19ee27
Keir Fraser [Wed, 22 Jul 2009 13:02:36 +0000 (14:02 +0100)]
Update QEMU_TAG to a42b67ed27a9744a2492c8ffe5c26935bd19ee27

16 years agoxsm: Move ACM_DEBUG and printkd() out of public header. They are
Keir Fraser [Tue, 21 Jul 2009 14:47:41 +0000 (15:47 +0100)]
xsm: Move ACM_DEBUG and printkd() out of public header. They are
private to the ACM implementation within Xen.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
16 years agoxsm: Do not use gcc-ism in public header file.
Keir Fraser [Tue, 21 Jul 2009 14:34:56 +0000 (15:34 +0100)]
xsm: Do not use gcc-ism in public header file.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>